package validator;

import model.Address;

public class AddressValidator {
	Address a;
	public AddressValidator(Address a){
		this.a = a;
	}
	
	public boolean isValid(){
		return isValidNewAddress() && a.getId() > 0;			
	}
	
	public boolean isValidNewAddress(){
		return
			a.getAddressType() > 0 &&
			a.getSubjectType() > 0 &&
			a.getSubject() > 0 &&
			a.getCountry() != null &&
			!a.getCountry().isEmpty() &&
			a.getCounty() != null &&
			!a.getCounty().isEmpty() &&
			a.getStreetAddress() != null &&
			!a.getStreetAddress().isEmpty() &&
			a.getZipcode() != null &&
			!a.getZipcode().isEmpty();					
	}
}
